package com.hmy.finance.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

/**
 * @author songkf
 */

@Getter
public enum PaymentStatusEnum {
    //回款标识 (1-未回款, 2-部分回款, 3-已回款)
    UNPAID("1", "未回款"),
    PARTIAL_PAYMENT("2", "部分回款"),
    PAID("3", "已回款"),
    WAIT_RECHARGE("4", "等待回充"),
    RECHARGED("5", "已回充");
    @EnumValue
    private final String value;
    private final String desc;

    private PaymentStatusEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    //获取desc
    public static String getDesc(String value) {
        for (PaymentStatusEnum e : values()) {
            if (e.getValue().equals(value)) {
                return e.getDesc();
            }
        }
        return null;
    }

    //get Enum by value
    public static PaymentStatusEnum getByValue(String value) {
        for (PaymentStatusEnum e : values()) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }
}
